//
//  SCHeaderCollectionViewCell.m
//  OurMoon
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "SCHeaderCollectionViewCell.h"
#import <UIImageView+WebCache.h>
#import "NightHeader.h"
#import "FitHeader.h"
@implementation SCHeaderCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createViews];
    }
    return self;
}

- (void)createViews
{
    _videoImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_videoImageView];
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.textAlignment = 1;
    _titleLabel.font = [UIFont systemFontOfSize:14 * FitWidth];
    [_titleLabel NightWithType:UIViewColorTypeNormal];
    [self.contentView addSubview:_titleLabel];
}
- (void)getkind:(SCHeaderCollectionViewKind)kind
{
    _kind = kind;
}

- (void)setVideoSidListModel:(VideoSidListModel *)videoSidListModel
{
    [_videoImageView sd_setImageWithURL:[NSURL URLWithString:videoSidListModel.imgsrc] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    _titleLabel.text = videoSidListModel.title;
}
- (void)setRadioStr:(NSString *)radioStr
{
    _titleLabel.text = radioStr;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    //视频
    if (_kind == SCHeaderCollectionViewCellByVideo) {
        _videoImageView.frame = CGRectMake(15 * FitWidth, 0, 50 * FitWidth, 50 * FitHeight);
        _titleLabel.frame = CGRectMake(_videoImageView.frame.origin.x, _videoImageView.frame.origin.y + _videoImageView.frame.size.height, _videoImageView.frame.size.width, 30 * FitHeight);
    }
    else{//电台
        _titleLabel.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 40 * FitHeight);
    }
}

@end
